//
//  MFWDataModel.h
//  MFWSdk
//
//  Created by Song Xiaofeng on 13-7-24.
//  Copyright (c) 2013年 Mafengwo Inc. All rights reserved.
//

#import <Foundation/Foundation.h>

extern NSString *const mfwDefaultDataId;

@interface MFWDataIdentifier : NSObject
@property(nonatomic, copy)NSString *dataCategoryName;
@property(nonatomic, copy)NSString *dataId;

// the same with identifierOfCategory:dataId: with dataId default value mfwDefaultDataId
+ (MFWDataIdentifier*)identifierOfCategory:(NSString*)dataCategoryName;

+ (MFWDataIdentifier*)identifierOfCategory:(NSString*)dataCategory dataId:(NSString*)dataId;
@end

@class MFWJson;
@class ASIHTTPRequest;
@class MFWHttpRequest;
@class MFWHttpTask;

@protocol MFWHttpTaskCallback;

@interface MFWDataModel : NSObject <MFWHttpTaskCallback>
{
    // key -> (NSString) dataId
    // value -> NSDictionary
    NSMutableDictionary *_dataDic;
}

+ (instancetype)managedModelInstance;

+ (NSString*)categoryName;

- (MFWJson*)jsonDataForDataId:(NSString*)dataId;

- (MFWHttpRequest*)mfwHttpRequestForTask:(MFWHttpTask*)task;

+ (void)addDataObserver:(id<MFWDataObserver>)anObserver;
+ (void)removeDataObserver:(id<MFWDataObserver>)anObserver;
@end
